package com.hdoit.ares.logical.acti.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.hdoit.ares.logical.acti.dao.IActiRewardDao;
import com.hdoit.ares.logical.acti.mapper.ActiRewardMapper;
import com.hdoit.ares.logical.acti.model.ActiReward;
import com.tennetcn.common.dao.base.IFinderExpression;
import com.tennetcn.common.dao.base.impl.SuperDao;
import com.tennetcn.common.enums.OrderEnum;
import com.tennetcn.common.utils.FinderExpressionFactory;
/**
 * @author      caochengmeng
 * @email       
 * @createtime  2018年03月10日 19:57:33
 * @comment
 */
@Component
public class ActiRewardDaoImpl extends SuperDao<ActiReward> implements IActiRewardDao{
	
	private ActiRewardMapper actiRewardMapper;
	public ActiRewardMapper getActiRewardMapper() {
		return actiRewardMapper;
	}
	@Resource
	public void setActiRewardMapper(ActiRewardMapper actiRewardMapper) {
		this.actiRewardMapper = actiRewardMapper;
	}

	@Override
	public List<ActiReward> queryList(String actiId) {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("*")
						.from(ActiReward.class)
						.andEq("actiId",actiId)
						.addOrder("rewardDate", OrderEnum.asc);
		return queryList(finderExpression);
	}
	
	@Override
	public ActiReward queryModelByCustId(String custId) {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("*")
						.from(ActiReward.class)
						.andEq("customerId",custId);
		return queryModel(finderExpression);
	}

	@Override
	public String querySumReward(String actiId) {
		return actiRewardMapper.querySumReward(actiId);
	}

}